﻿using System;
using System.Drawing;
using NUnit.Framework;
using Xenta.Utils;

namespace Xenta.Tests.Utils
{
    public class StringHelperTest : TestSkeleton
    {
        [TestCase("128, 34, 125, 75", typeof(Color))]
        public void Can_ParseAs(string s, Type t)
        {
            var def = t.IsValueType 
                ? Activator.CreateInstance(t) 
                : null;
            var obj = StringHelper.ParseAs(s, t, def);

            obj.GetType().AreEqual(t);
            Console.WriteLine(obj);
            obj.AreNotEqual(def);
        }
    }
}
